<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Act extends Model
{
    protected $table = 'act';

    protected $primaryKey = 'act_id';

    public $timestamps = false;
    //白名单
    protected $fillable = [
        'act_id', //id
        'title', //活动标题
        'describe', //描述
        'image', //图片
        'image_oss',
        'status', //1-启用 0-禁用
    ];

    protected $casts = ['image'];

    public function getImageAttribute($value)
    {
        return \App\Library\HandleFile::handleFilePath($value, $this->image_oss);
    }

    public function active()
    {
        return $this->hasOne('App\\Models\\Active', 'act_id', 'act_id');
    }
}
